package studentPackage;

import java.io.*;

public class UndergraduateStudent implements Student, Serializable {
	

	private static final long serialVersionUID = 1L;
	
	private String firstName;
	private String lastName;
	private boolean hasTax;
	private boolean hasGradeRetention;
	private boolean hasYearRetention;
	private boolean isGraduate;
	private int programId;
	private int taxValue;
	private int yearOfStudy;

	public UndergraduateStudent() {
		
		this.firstName = null;
		this.lastName = null;
		this.hasTax = false;
		this.hasGradeRetention = false;
		this.hasYearRetention = false;
		this.isGraduate = false;
		this.programId = 0;
		this.taxValue = 0;
		this.yearOfStudy = 0;
			
	}
	
	public UndergraduateStudent(String firstName, String lastName, boolean hasTax,
			boolean hasGradeRetention, boolean hasYearRetention,  boolean isGraduate, 
			int programId, int taxValue, int yearOfStudy) {
		
		this.firstName = firstName;
		this.lastName = lastName;
		this.hasTax = hasTax;
		this.hasGradeRetention = hasGradeRetention;
		this.hasYearRetention = hasYearRetention;
		this.programId = programId;
		this.taxValue = taxValue;
		this.yearOfStudy = yearOfStudy;
		
	}

	/*Metode getter*/
	public String getFirstName() {
		return this.firstName;		
	}

	public String getLastName() {		
		return this.lastName;		
	}

	public boolean getHasTax() {		
		return this.hasTax;		
	}
	
	public boolean getHasGradeRetention() {		
		return this.hasGradeRetention;	
	}
	
	public boolean getHasYearRetention() {
		return hasYearRetention;
	}
	
	public boolean getIsGraduate() {
		return this.isGraduate;
	}
	
	public int getProgramId() {	
		return this.programId;	
	}
	
	public int getTaxValue() {
		return taxValue;
	}
	
	public int getYearOfStudy() {
		return yearOfStudy;
	}
	
	/*Metode setter*/

	public void setFirstName(String firstName) {	
		this.firstName = firstName;	
	}
	
	public void setLastName(String lastName) {	
		this.lastName = lastName;		
	}

	public void setHasTax(boolean hasTax) {
		this.hasTax = hasTax;		
	}
	
	public void setHasGradeRetention(boolean hasGradeRetention) {	
		this.hasGradeRetention = hasGradeRetention;	
	}
	
	public void setHasYearRetention(boolean hasYearRetention) {
		this.hasYearRetention = hasYearRetention;
	}
	
	public void setIsGraduate(boolean isGraduate) {
		this.isGraduate = isGraduate;
	}
	
	public void setProgramId(int programId) {		
		this.programId = programId;		
	}
	
	public void setTaxValue(int taxValue) {
		this.taxValue = taxValue;
	}
	
	public void setYearOfStudy(int yearOfStudy) {
		this.yearOfStudy = yearOfStudy;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((firstName == null) ? 0 : firstName.hashCode());
		result = prime * result + (hasTax ? 1231 : 1237);
		result = prime * result + (isGraduate ? 1231 : 1237);
		result = prime * result
				+ ((lastName == null) ? 0 : lastName.hashCode());
		result = prime * result + programId;
		result = prime * result + yearOfStudy;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		UndergraduateStudent other = (UndergraduateStudent) obj;
		if (firstName == null) {
			if (other.firstName != null) {
				return false;
			}
		} else if (!firstName.equals(other.firstName)) {
			return false;
		}
		if (hasTax != other.hasTax) {
			return false;
		}
		if (isGraduate != other.isGraduate) {
			return false;
		}
		if (lastName == null) {
			if (other.lastName != null) {
				return false;
			}
		} else if (!lastName.equals(other.lastName)) {
			return false;
		}
		if (programId != other.programId) {
			return false;
		}
		if (yearOfStudy != other.yearOfStudy) {
			return false;
		}
		return true;
	}
	
	public int getHoursPerWeek() {
		return 30;
	}
	
}
